<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GNetworkMonitor: GIO Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="highlevel-socket.html" title="High-level network functionallity">
<link rel="prev" href="GThreadedSocketService.html" title="GThreadedSocketService">
<link rel="next" href="tls.html" title="TLS (SSL) support">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#GNetworkMonitor.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#GNetworkMonitor.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_prerequisites">  <span class="dim">|</span> 
                  <a href="#GNetworkMonitor.prerequisites" class="shortcut">Prerequisites</a></span><span id="nav_properties">  <span class="dim">|</span> 
                  <a href="#GNetworkMonitor.properties" class="shortcut">Properties</a></span><span id="nav_signals">  <span class="dim">|</span> 
                  <a href="#GNetworkMonitor.signals" class="shortcut">Signals</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="highlevel-socket.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="GThreadedSocketService.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="tls.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GNetworkMonitor"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GNetworkMonitor.top_of_page"></a>GNetworkMonitor</span></h2>
<p>GNetworkMonitor — Network status monitor</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="GNetworkMonitor.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="returnvalue">GNetworkMonitor</span></a> *
</td>
<td class="function_name">
<a class="link" href="GNetworkMonitor.html#g-network-monitor-get-default" title="g_network_monitor_get_default ()">g_network_monitor_get_default</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GNetworkMonitor.html#g-network-monitor-get-network-available" title="g_network_monitor_get_network_available ()">g_network_monitor_get_network_available</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GNetworkMonitor.html#g-network-monitor-get-network-metered" title="g_network_monitor_get_network_metered ()">g_network_monitor_get_network_metered</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach" title="g_network_monitor_can_reach ()">g_network_monitor_can_reach</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach-async" title="g_network_monitor_can_reach_async ()">g_network_monitor_can_reach_async</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach-finish" title="g_network_monitor_can_reach_finish ()">g_network_monitor_can_reach_finish</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GNetworkMonitor.html#GNetworkConnectivity" title="enum GNetworkConnectivity"><span class="returnvalue">GNetworkConnectivity</span></a>
</td>
<td class="function_name">
<a class="link" href="GNetworkMonitor.html#g-network-monitor-get-connectivity" title="g_network_monitor_get_connectivity ()">g_network_monitor_get_connectivity</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GNetworkMonitor.properties"></a><h2>Properties</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody>
<tr>
<td class="property_type"><a class="link" href="GNetworkMonitor.html#GNetworkConnectivity" title="enum GNetworkConnectivity"><span class="type">GNetworkConnectivity</span></a></td>
<td class="property_name"><a class="link" href="GNetworkMonitor.html#GNetworkMonitor--connectivity" title="The “connectivity” property">connectivity</a></td>
<td class="property_flags">Read</td>
</tr>
<tr>
<td class="property_type"><a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
<td class="property_name"><a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-available" title="The “network-available” property">network-available</a></td>
<td class="property_flags">Read</td>
</tr>
<tr>
<td class="property_type"><a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
<td class="property_name"><a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-metered" title="The “network-metered” property">network-metered</a></td>
<td class="property_flags">Read</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GNetworkMonitor.signals"></a><h2>Signals</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="signals_return">
<col width="300px" class="signals_name">
<col width="200px" class="signals_flags">
</colgroup>
<tbody><tr>
<td class="signal_type"><span class="returnvalue">void</span></td>
<td class="signal_name"><a class="link" href="GNetworkMonitor.html#GNetworkMonitor-network-changed" title="The “network-changed” signal">network-changed</a></td>
<td class="signal_flags"><a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GNetworkMonitor.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="GNetworkMonitor.html#GNetworkMonitor-struct" title="GNetworkMonitor">GNetworkMonitor</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GNetworkMonitor.html#GNetworkMonitorInterface" title="struct GNetworkMonitorInterface">GNetworkMonitorInterface</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="GNetworkMonitor.html#G-NETWORK-MONITOR-EXTENSION-POINT-NAME:CAPS" title="G_NETWORK_MONITOR_EXTENSION_POINT_NAME">G_NETWORK_MONITOR_EXTENSION_POINT_NAME</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="GNetworkMonitor.html#GNetworkConnectivity" title="enum GNetworkConnectivity">GNetworkConnectivity</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GNetworkMonitor.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    <a href="/home/desrt/Install/jhbuild/share/gtk-doc/html/gobject/GTypeModule.html">GInterface</a>
    <span class="lineart">╰──</span> GNetworkMonitor
</pre>
</div>
<div class="refsect1">
<a name="GNetworkMonitor.prerequisites"></a><h2>Prerequisites</h2>
<p>
GNetworkMonitor requires
 <a class="link" href="GInitable.html" title="GInitable">GInitable</a> and  <a href="../gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>.</p>
</div>
<div class="refsect1">
<a name="GNetworkMonitor.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gio/gio.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GNetworkMonitor.description"></a><h2>Description</h2>
<p><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> provides an easy-to-use cross-platform API
for monitoring network connectivity. On Linux, the implementation
is based on the kernel's netlink interface.</p>
</div>
<div class="refsect1">
<a name="GNetworkMonitor.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="g-network-monitor-get-default"></a><h3>g_network_monitor_get_default ()</h3>
<pre class="programlisting"><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="returnvalue">GNetworkMonitor</span></a> *
g_network_monitor_get_default (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Gets the default <a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> for the system.</p>
<div class="refsect3">
<a name="g-network-monitor-get-default.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a>. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-network-monitor-get-network-available"></a><h3>g_network_monitor_get_network_available ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_network_monitor_get_network_available
                               (<em class="parameter"><code><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> *monitor</code></em>);</pre>
<p>Checks if the network is available. "Available" here means that the
system has a default route available for at least one of IPv4 or
IPv6. It does not necessarily imply that the public Internet is
reachable. See <a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-available" title="The “network-available” property"><span class="type">“network-available”</span></a> for more details.</p>
<div class="refsect3">
<a name="g-network-monitor-get-network-available.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>monitor</p></td>
<td class="parameter_description"><p>the <a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-network-monitor-get-network-available.returns"></a><h4>Returns</h4>
<p> whether the network is available</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-network-monitor-get-network-metered"></a><h3>g_network_monitor_get_network_metered ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_network_monitor_get_network_metered (<em class="parameter"><code><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> *monitor</code></em>);</pre>
<p>Checks if the network is metered.
See <a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-metered" title="The “network-metered” property"><span class="type">“network-metered”</span></a> for more details.</p>
<div class="refsect3">
<a name="g-network-monitor-get-network-metered.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>monitor</p></td>
<td class="parameter_description"><p>the <a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-network-monitor-get-network-metered.returns"></a><h4>Returns</h4>
<p> whether the connection is metered</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-46.html#api-index-2.46">2.46</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-network-monitor-can-reach"></a><h3>g_network_monitor_can_reach ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_network_monitor_can_reach (<em class="parameter"><code><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> *monitor</code></em>,
                             <em class="parameter"><code><a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> *connectable</code></em>,
                             <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                             <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Attempts to determine whether or not the host pointed to by
<em class="parameter"><code>connectable</code></em>
 can be reached, without actually trying to connect to
it.</p>
<p>This may return <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> even when <a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-available" title="The “network-available” property"><span class="type">“network-available”</span></a>
is <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, if, for example, <em class="parameter"><code>monitor</code></em>
 can determine that
<em class="parameter"><code>connectable</code></em>
 refers to a host on a local network.</p>
<p>If <em class="parameter"><code>monitor</code></em>
 believes that an attempt to connect to <em class="parameter"><code>connectable</code></em>

will succeed, it will return <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. Otherwise, it will return
<a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and set <em class="parameter"><code>error</code></em>
 to an appropriate error (such as
<a class="link" href="gio-GIOError.html#G-IO-ERROR-HOST-UNREACHABLE:CAPS"><code class="literal">G_IO_ERROR_HOST_UNREACHABLE</code></a>).</p>
<p>Note that although this does not attempt to connect to
<em class="parameter"><code>connectable</code></em>
, it may still block for a brief period of time (eg,
trying to do multicast DNS on the local network), so if you do not
want to block, you should use <a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach-async" title="g_network_monitor_can_reach_async ()"><code class="function">g_network_monitor_can_reach_async()</code></a>.</p>
<div class="refsect3">
<a name="g-network-monitor-can-reach.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>monitor</p></td>
<td class="parameter_description"><p>a <a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>connectable</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p> a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-network-monitor-can-reach.returns"></a><h4>Returns</h4>
<p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>connectable</code></em>
is reachable, <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-network-monitor-can-reach-async"></a><h3>g_network_monitor_can_reach_async ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_network_monitor_can_reach_async (<em class="parameter"><code><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> *monitor</code></em>,
                                   <em class="parameter"><code><a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> *connectable</code></em>,
                                   <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                   <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                   <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>Asynchronously attempts to determine whether or not the host
pointed to by <em class="parameter"><code>connectable</code></em>
 can be reached, without actually
trying to connect to it.</p>
<p>For more details, see <a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach" title="g_network_monitor_can_reach ()"><code class="function">g_network_monitor_can_reach()</code></a>.</p>
<p>When the operation is finished, <em class="parameter"><code>callback</code></em>
 will be called.
You can then call <a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach-finish" title="g_network_monitor_can_reach_finish ()"><code class="function">g_network_monitor_can_reach_finish()</code></a>
to get the result of the operation.</p>
<div class="refsect3">
<a name="g-network-monitor-can-reach-async.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>monitor</p></td>
<td class="parameter_description"><p>a <a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>connectable</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p> a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>callback</p></td>
<td class="parameter_description"><p> a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the
request is satisfied. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p> the data to pass to callback function. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-network-monitor-can-reach-finish"></a><h3>g_network_monitor_can_reach_finish ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_network_monitor_can_reach_finish (<em class="parameter"><code><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> *monitor</code></em>,
                                    <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
                                    <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Finishes an async network connectivity test.
See <a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach-async" title="g_network_monitor_can_reach_async ()"><code class="function">g_network_monitor_can_reach_async()</code></a>.</p>
<div class="refsect3">
<a name="g-network-monitor-can-reach-finish.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>monitor</p></td>
<td class="parameter_description"><p>a <a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for errors, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-network-monitor-can-reach-finish.returns"></a><h4>Returns</h4>
<p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if network is reachable, <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-network-monitor-get-connectivity"></a><h3>g_network_monitor_get_connectivity ()</h3>
<pre class="programlisting"><a class="link" href="GNetworkMonitor.html#GNetworkConnectivity" title="enum GNetworkConnectivity"><span class="returnvalue">GNetworkConnectivity</span></a>
g_network_monitor_get_connectivity (<em class="parameter"><code><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> *monitor</code></em>);</pre>
<p>Gets a more detailed networking state than
<a class="link" href="GNetworkMonitor.html#g-network-monitor-get-network-available" title="g_network_monitor_get_network_available ()"><code class="function">g_network_monitor_get_network_available()</code></a>.</p>
<p>If <a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-available" title="The “network-available” property"><span class="type">“network-available”</span></a> is <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, then the
connectivity state will be <a class="link" href="GNetworkMonitor.html#G-NETWORK-CONNECTIVITY-LOCAL:CAPS"><code class="literal">G_NETWORK_CONNECTIVITY_LOCAL</code></a>.</p>
<p>If <a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-available" title="The “network-available” property"><span class="type">“network-available”</span></a> is <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, then the
connectivity state will be <a class="link" href="GNetworkMonitor.html#G-NETWORK-CONNECTIVITY-FULL:CAPS"><code class="literal">G_NETWORK_CONNECTIVITY_FULL</code></a> (if there
is full Internet connectivity), <a class="link" href="GNetworkMonitor.html#G-NETWORK-CONNECTIVITY-LIMITED:CAPS"><code class="literal">G_NETWORK_CONNECTIVITY_LIMITED</code></a> (if
the host has a default route, but appears to be unable to actually
reach the full Internet), or <a class="link" href="GNetworkMonitor.html#G-NETWORK-CONNECTIVITY-PORTAL:CAPS"><code class="literal">G_NETWORK_CONNECTIVITY_PORTAL</code></a> (if the
host is trapped behind a "captive portal" that requires some sort
of login or acknowledgement before allowing full Internet access).</p>
<p>Note that in the case of <a class="link" href="GNetworkMonitor.html#G-NETWORK-CONNECTIVITY-LIMITED:CAPS"><code class="literal">G_NETWORK_CONNECTIVITY_LIMITED</code></a> and
<a class="link" href="GNetworkMonitor.html#G-NETWORK-CONNECTIVITY-PORTAL:CAPS"><code class="literal">G_NETWORK_CONNECTIVITY_PORTAL</code></a>, it is possible that some sites are
reachable but others are not. In this case, applications can
attempt to connect to remote servers, but should gracefully fall
back to their "offline" behavior if the connection attempt fails.</p>
<div class="refsect3">
<a name="g-network-monitor-get-connectivity.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>monitor</p></td>
<td class="parameter_description"><p>the <a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-network-monitor-get-connectivity.returns"></a><h4>Returns</h4>
<p> the network connectivity state</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-44.html#api-index-2.44">2.44</a></p>
</div>
</div>
<div class="refsect1">
<a name="GNetworkMonitor.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GNetworkMonitor-struct"></a><h3>GNetworkMonitor</h3>
<pre class="programlisting">typedef struct _GNetworkMonitor GNetworkMonitor;</pre>
<p><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> monitors the status of network connections and
indicates when a possibly-user-visible change has occurred.</p>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GNetworkMonitorInterface"></a><h3>struct GNetworkMonitorInterface</h3>
<pre class="programlisting">struct GNetworkMonitorInterface {
  GTypeInterface g_iface;

  void     (*network_changed)  (GNetworkMonitor      *monitor,
				gboolean              available);

  gboolean (*can_reach)        (GNetworkMonitor      *monitor,
				GSocketConnectable   *connectable,
				GCancellable         *cancellable,
				GError              **error);
  void     (*can_reach_async)  (GNetworkMonitor      *monitor,
				GSocketConnectable   *connectable,
				GCancellable         *cancellable,
				GAsyncReadyCallback   callback,
				gpointer              user_data);
  gboolean (*can_reach_finish) (GNetworkMonitor      *monitor,
				GAsyncResult         *result,
				GError              **error);
};
</pre>
<p>The virtual function table for <a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a>.</p>
<div class="refsect3">
<a name="GNetworkMonitorInterface.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GNetworkMonitorInterface.network-changed"></a>network_changed</code></em> ()</p></td>
<td class="struct_member_description"><p>the virtual function pointer for the
GNetworkMonitor::network-changed signal.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GNetworkMonitorInterface.can-reach"></a>can_reach</code></em> ()</p></td>
<td class="struct_member_description"><p>the virtual function pointer for <a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach" title="g_network_monitor_can_reach ()"><code class="function">g_network_monitor_can_reach()</code></a></p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GNetworkMonitorInterface.can-reach-async"></a>can_reach_async</code></em> ()</p></td>
<td class="struct_member_description"><p>the virtual function pointer for
<a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach-async" title="g_network_monitor_can_reach_async ()"><code class="function">g_network_monitor_can_reach_async()</code></a></p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GNetworkMonitorInterface.can-reach-finish"></a>can_reach_finish</code></em> ()</p></td>
<td class="struct_member_description"><p>the virtual function pointer for
<a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach-finish" title="g_network_monitor_can_reach_finish ()"><code class="function">g_network_monitor_can_reach_finish()</code></a></p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="G-NETWORK-MONITOR-EXTENSION-POINT-NAME:CAPS"></a><h3>G_NETWORK_MONITOR_EXTENSION_POINT_NAME</h3>
<pre class="programlisting">#define G_NETWORK_MONITOR_EXTENSION_POINT_NAME "gio-network-monitor"
</pre>
<p>Extension point for network status monitoring functionality.
See Extending GIO.</p>
<p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GNetworkConnectivity"></a><h3>enum GNetworkConnectivity</h3>
<p>The host's network connectivity state, as reported by <a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a>.</p>
<div class="refsect3">
<a name="GNetworkConnectivity.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="G-NETWORK-CONNECTIVITY-LOCAL:CAPS"></a>G_NETWORK_CONNECTIVITY_LOCAL</p></td>
<td class="enum_member_description">
<p>The host is not configured with a
  route to the Internet; it may or may not be connected to a local
  network.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-NETWORK-CONNECTIVITY-LIMITED:CAPS"></a>G_NETWORK_CONNECTIVITY_LIMITED</p></td>
<td class="enum_member_description">
<p>The host is connected to a network, but
  does not appear to be able to reach the full Internet, perhaps
  due to upstream network problems.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-NETWORK-CONNECTIVITY-PORTAL:CAPS"></a>G_NETWORK_CONNECTIVITY_PORTAL</p></td>
<td class="enum_member_description">
<p>The host is behind a captive portal and
  cannot reach the full Internet.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-NETWORK-CONNECTIVITY-FULL:CAPS"></a>G_NETWORK_CONNECTIVITY_FULL</p></td>
<td class="enum_member_description">
<p>The host is connected to a network, and
  appears to be able to reach the full Internet.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-44.html#api-index-2.44">2.44</a></p>
</div>
</div>
<div class="refsect1">
<a name="GNetworkMonitor.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GNetworkMonitor--connectivity"></a><h3>The <code class="literal">“connectivity”</code> property</h3>
<pre class="programlisting">  “connectivity”             <a class="link" href="GNetworkMonitor.html#GNetworkConnectivity" title="enum GNetworkConnectivity"><span class="type">GNetworkConnectivity</span></a></pre>
<p>More detailed information about the host's network connectivity.
See <a class="link" href="GNetworkMonitor.html#g-network-monitor-get-connectivity" title="g_network_monitor_get_connectivity ()"><code class="function">g_network_monitor_get_connectivity()</code></a> and
<a class="link" href="GNetworkMonitor.html#GNetworkConnectivity" title="enum GNetworkConnectivity"><span class="type">GNetworkConnectivity</span></a> for more details.</p>
<p>Flags: Read</p>
<p>Default value: G_NETWORK_CONNECTIVITY_FULL</p>
<p class="since">Since: <a class="link" href="api-index-2-44.html#api-index-2.44">2.44</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GNetworkMonitor--network-available"></a><h3>The <code class="literal">“network-available”</code> property</h3>
<pre class="programlisting">  “network-available”        <a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
<p>Whether the network is considered available. That is, whether the
system has a default route for at least one of IPv4 or IPv6.</p>
<p>Real-world networks are of course much more complicated than
this; the machine may be connected to a wifi hotspot that
requires payment before allowing traffic through, or may be
connected to a functioning router that has lost its own upstream
connectivity. Some hosts might only be accessible when a VPN is
active. Other hosts might only be accessible when the VPN is
not active. Thus, it is best to use <a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach" title="g_network_monitor_can_reach ()"><code class="function">g_network_monitor_can_reach()</code></a>
or <a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach-async" title="g_network_monitor_can_reach_async ()"><code class="function">g_network_monitor_can_reach_async()</code></a> to test for reachability
on a host-by-host basis. (On the other hand, when the property is
<a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, the application can reasonably expect that no remote
hosts at all are reachable, and should indicate this to the user
in its UI.)</p>
<p>See also <a class="link" href="GNetworkMonitor.html#GNetworkMonitor-network-changed" title="The “network-changed” signal"><span class="type">“network-changed”</span></a>.</p>
<p>Flags: Read</p>
<p>Default value: FALSE</p>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GNetworkMonitor--network-metered"></a><h3>The <code class="literal">“network-metered”</code> property</h3>
<pre class="programlisting">  “network-metered”          <a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
<p>Whether the network is considered metered. That is, whether the
system has traffic flowing through the default connection that is
subject to limitations set by service providers. For example, traffic
might be billed by the amount of data transmitted, or there might be a
quota on the amount of traffic per month. This is typical with tethered
connections (3G and 4G) and in such situations, bandwidth intensive
applications may wish to avoid network activity where possible if it will
cost the user money or use up their limited quota.</p>
<p>If more information is required about specific devices then the
system network management API should be used instead (for example,
NetworkManager or ConnMan).</p>
<p>If this information is not available then no networks will be
marked as metered.</p>
<p>See also <a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-available" title="The “network-available” property"><span class="type">“network-available”</span></a>.</p>
<p>Flags: Read</p>
<p>Default value: FALSE</p>
<p class="since">Since: <a class="link" href="api-index-2-46.html#api-index-2.46">2.46</a></p>
</div>
</div>
<div class="refsect1">
<a name="GNetworkMonitor.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="GNetworkMonitor-network-changed"></a><h3>The <code class="literal">“network-changed”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
user_function (<a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> *monitor,
               <a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>         available,
               <a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>         user_data)</pre>
<p>Emitted when the network configuration changes. If <em class="parameter"><code>available</code></em>
 is
<a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, then some hosts may be reachable that were not reachable
before, while others that were reachable before may no longer be
reachable. If <em class="parameter"><code>available</code></em>
 is <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, then no remote hosts are
reachable.</p>
<div class="refsect3">
<a name="GNetworkMonitor-network-changed.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>monitor</p></td>
<td class="parameter_description"><p>a <a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>available</p></td>
<td class="parameter_description"><p>the current value of <a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-available" title="The “network-available” property"><span class="type">“network-available”</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p>Flags: <a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>